using UnityEngine;
using QFramework;
using UnityEngine.UI;

namespace ProjectIndieFarm
{
    public partial class PowerUpItemTemplate : ViewController
    {
        public BindableProperty<bool> IsInteractable = new(false);
        void Start()
        {
            IsInteractable.RegisterWithInitValue(interactable =>
            {
                if (interactable)
                {
                    Btn.interactable = true;
                    Btn.GetComponentInChildren<Text>().ColorAlpha(1.0f);
                }
                else
                {
                    Btn.interactable = false;
                    Btn.GetComponentInChildren<Text>().ColorAlpha(0.6f);
                }
            }).UnRegisterWhenGameObjectDestroyed(gameObject);
        }
    }
}
